<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('清算数据列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label style="width: 100px;">商户编号：</label>
                            <input type="text" name="merno"/>
                        </li>
                        <li>
                            <label style="width: 100px;">上游商户编号：</label>
                            <input type="text" name="ldMerno"/>
                        </li>
                        <li>
                            <label style="width: 100px;">服务编号：</label>
                            <input type="text" name="agentNum"/>
                        </li>
                        <li>
                            <label style="width: 100px;">交易卡号：</label>
                            <input type="text" name="pan"/>
                        </li>
                        <li>
                            <label style="width: 100px;">卡类型：</label>
                            <select name="cardtype">
                                <option value="">所有</option>
                                <option value="0">未知</option>
                                <option value="1">借记卡</option>
                                <option value="2">贷记卡</option>
                                <option value="3">预付费卡</option>
                            </select>
                        </li>
                        <li>
                            <label style="width: 100px;">交易流水：</label>
                            <input type="text" name="serial"/>
                        </li>
                        <li>
                            <label style="width: 100px;">出款流水：</label>
                            <input type="text" name="settleSerial"/>
                        </li>
                        <li>
                            <label style="width: 100px;" >终端号：</label>
                            <input type="text" name="posno"/>
                        </li>
                        <li>
                            <label style="width: 100px;">出款状态：</label>
                            <select name="settleState">
                                <option value="">所有</option>
                                <option value="0">处理中</option>
                                <option value="1">出款成功</option>
                                <option value="-2">出款失败</option>
                                <option value="-1">以上送</option>
                                <option value="-3">冻结</option>
                            </select>
                        </li>
                        <li>
                            <label style="width: 100px;">支付类型：</label>
                            <select name="isonline">
                                <option value="">所有</option>
                                <option value="0">线下交易</option>
                                <option value="1">线上交易</option>
                            </select>
                        </li>
                        <li class="select-time">
                            <label style="width: 100px;">清算日期：</label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始日期" name="params[beginAddTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束日期" name="params[endAddTime]"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-danger" onclick="frbl()" >
                <i class="fa fa-edit"></i> 分润补录
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" class="table text-nowrap"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('auditdata:auditdata:edit')}]];
    var removeFlag = [[${@permission.hasPermi('auditdata:auditdata:remove')}]];
    var prefix = ctx + "auditdata/auditdata";

    $(function () {
        var options = {
            url: prefix + "/getList2",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "清算数据",
            firstLoad:false,
            clickToSelect:true,
            columns: [
                {
                    checkbox: true
                },
                {
                    field: 'serial',
                    title: '交易流水号',
                },
                {
                    field: 'merno',
                    title: '商户编号'
                },
                {
                    field: 'ldMerno',
                    title: '上游商户编号'
                },
                {
                    field: 'merchantInfo.merName',
                    title: '商户名称'
                },
                {
                    field: 'agentNum',
                    title: '服务商编号'
                },
                {
                    field: 'agentInfo.agentName',
                    title: '服务商名称'
                },
                {
                    field: 'screenName',
                    title: '结算人'
                },
                {
                    field: 'showScreennum',
                    title: '结算卡号'
                },
                {
                    field: 'posno',
                    title: '终端号'
                },
                {
                    field: 'msgtype',
                    title: '交易类型',
                    formatter: function (value, row, index) {
                        if ("H007" == value) {
                            return '<span style="color:blue;">消费</span>';
                        } else if ("H014" == value) {
                            return '<span style="color:red;">退货</span>';
                        } else if ("S007" == value) {
                            return '<span style="color:blue;">'+$.table.tooltip('SIM卡年费',2)+'</span>';
                        } else if ("V007" == value) {
                            return '<span style="color:green;">'+$.table.tooltip('会员交易',2)+'</span>';
                        } else if ("C007" == value) {
                            return '<span style="color:blue;">'+$.table.tooltip('手机充值',2)+'</span>';
                        } else if ("H201" == value) {
                            return '<span style="color:blue;">'+$.table.tooltip('支付宝',2)+'</span>';
                        } else if ("H202" == value) {
                            return '<span style="color:red;">微信</span>';
                        } else if ("H302" == value) {
                            return '<span style="color:blue;">'+$.table.tooltip('银联二维码',2)+'</span>';
                        } else if ("H304" == value) {
                            return '<span style="color:blue;">码付</span>';
                        } else {
                            return "未知";
                        }
                    }
                },
                {
                    field: 'pan',
                    title: '交易卡号',
                    formatter:function (value, row, index) {
                        return $.table.tooltip(value,14);
                    }
                },
                {
                    field: 'localdate',
                    title: '清算日期'
                },
                {
                    field: 'localdate',
                    title: '交易日期'
                },
                {
                    field: 'localtime',
                    title: '交易时间'
                },
                {
                    field: 'amount',
                    title: '交易金额(元)',
                    formatter: function (value, row, index) {
                        return $.table.rmbFormatter(value);
                    }
                },
                {
                    field: 'rateCode',
                    title: '结算费率'
                },
                {
                    field: 'charge',
                    title: '手续费(元)',
                    formatter: function (value, row, index) {
                        return $.table.rmbFormatter(value);
                    }
                },
                {
                    field: 'rateAffix',
                    title: '附加费率'
                },
                {
                    field: 'affixCharge',
                    title: '附加手续费',
                    formatter: function (value, row, index) {
                        return $.table.rmbFormatter(value);
                    }
                },
                {
                    field: 'tmoney',
                    title: '结算金额(元)',
                    formatter: function (value, row, index) {
                        return $.table.rmbFormatter(value);
                    }
                },
                {
                    field: 'isonline',
                    title: '支付类型',
                    formatter: function (value, row, index) {
                        if ("0" == value) {
                            return ' <span style="color:blue;">线下交易</span>';
                        } else if ("1" == value) {
                            return ' <span style="color:green;">线上交易</span>';
                        }
                    }
                },
                {
                    field: 'settType',
                    title: '结算类型',
                    formatter: function (value, row, index) {
                        if ("0" == value) {
                            return '<span style="color:blue;">D0</span>';
                        } else if ("1" == value) {
                            return '<span style="color:green;">T1</span>';
                        }
                    }
                },
                {
                    field: 'cardtype',
                    title: '卡类型',
                    formatter: function (value, row, index) {
                        if ("0" == value) {
                            return '<span style="color:blue;">未知</span>';
                        } else if ("1" == value) {
                            return '<span style="color:green;">借记卡</span>';
                        } else if ("2" == value) {
                            return '<span style="color:blue;">贷记卡</span>';
                        } else if ("3" == value) {
                            return '<span style="color:red;">预付费卡</span>';
                        }
                    }
                },
                {
                    field: 'settleState',
                    title: '出款状态',
                    formatter: function (value, row, index) {
                        if ("0" == value) {
                            return '<span style="color:blue;">待处理</span>';
                        } else if ("1" == value) {
                            return '<span style="color:green;">出款成功</span>';
                        } else if ("-2" == value) {
                            return '<span style="color:red;">出款失败</span>';
                        } else if ("-3" == value) {
                            return ' <span style="color:yellow;">冻结</span>';
                        } else if ("-1" == value) {
                            return ' <span style="color:#548187;">已上送</span>';
                        } else {
                            return ' <span style="color:red;">未知</span>';
                        }
                    }
                },
                ]
        };
        $.table.init(options);
    });

    function frbl() {
        var serial = $.table.selectColumns("serial");
        $.modal.confirm("确定要进行分润补录操作吗?", function() {
            $.post(prefix + "/saveUpdateFr",{"ids":serial.toString()},function(result){
                if (result.code == '0'){
                    $.table.refresh();
                    $.modal.msgSuccess(result.msg);
                    return;
                } else {
                    $.modal.msgError(result.msg);
                    return;
                }
            });
        })
    }
</script>
</body>
</html>